package com.zhihaoliang.animationtrain.util

import android.graphics.Paint
import android.graphics.drawable.ShapeDrawable

/**
 * 创建日期：2020/3/28
 * 描述:用于保存Shape，用于动画
 * 作者:支豪亮
 */
class ShapeHolder(val shapeDrawable: ShapeDrawable) {
    /**
     * Shape的X坐标
     */
    var x:Float= 0F
    /**
     * Shape的Y坐标
     */
    var y:Float= 0F

    var paint:Paint? =null

    var width:Float = 0.0f
        set(value) {
        field= value
        shapeDrawable.shape.resize(value,height)
    }
    get() = shapeDrawable.shape.width


    var height:Float = 0.0f
        set(value) {
        field = value
        shapeDrawable.shape.resize(width,value)
    }
    get() = shapeDrawable.shape.height

    var alpha:Float =0.0f
    set(value) {
        field = value
        shapeDrawable.alpha = (value * 255 +0.5F).toInt()
    }

}